#include <cstdio>

__int64 f[ 26 ], c[ 26 ][ 26 ];

__int64 find( int n )
{
    if ( f[ n ] != -1 )
        return f[ n ];
    return f[ n ] = ( n - 1 ) * ( find( n - 1 ) + find( n - 2 ) );
}

__int64 C( int a, int b )
{
    if ( c[ a ][ b ] != -1 )
        return c[ a ][ b ];
    return c[ a ][ b ] = C( a, b - 1 ) * ( a - b + 1 ) / b;
}

int main( )
{
    int n, i, j;
    __int64 sum;
    for ( i = 1; i <= 25; i++ )
    {
        for ( j = 1; j <= 25; j++ )
            c[ i ][ j ] = -1;
        f[ i ] = -1;
        c[ i ][ 0 ] = 1;
    }
    f[ 1 ] = 0;
    f[ 2 ] = 1;
    while ( scanf("%d", &n) != EOF && n )
    {
        sum = 1;
        for ( i = 1; i <= n / 2; i++ )
            sum += find( i ) * C( n, i );
        printf("%I64d\n", sum);
    }
    return 0;
}
